package com.gs.SynAntiWandering.presenter;

import java.lang.ref.WeakReference;

public class BasePresenter<T> {

    protected WeakReference<T> mViewRef;

    public void attachView(T view){
        mViewRef = new WeakReference<T>(view);
    }

    public void detachView(){
        if (mViewRef != null) {
            mViewRef.clear();
        }
    }

    protected T getView(){
        if (mViewRef != null) {
            return mViewRef.get();
        }
        return null;
    }
}
